from Rk.zk9_29.Base import Base
from selenium.webdriver.common.by import By

class Page1(Base):
    #点击登录
    login_loc = (By.XPATH,'/html/body/div[1]/div/div[2]/ul/li[1]/a')
    def login(self):
        self.click(self.login_loc)
    #断言会员登录
    dy1_loc = (By.CLASS_NAME,'reg-new')
    def dy1(self):
      return  self.text(self.dy1_loc)
    assert '会员登录'==dy1()
    #输入用户名
    username_loc = (By.NAME,'username')
    def username(self):
        self.send_keys(self.username_loc,'666666')
    #输入密码
    password_loc = (By.NAME, 'password')
    def password(self):
        self.send_keys(self.password_loc, '666666')
    #点击登录按钮
    loginbuttn_loc = (By.CSS_SELECTOR,'.finish-btn')
    def loginbuttn(self):
        self.click(self.loginbuttn_loc)
    #点击首页
    souye_loc = (By.XPATH,'/html/body/div[3]/div[2]/ul/li[1]/a')
    def souye(self):
        self.click(self.souye_loc)
    #点击商品查看详情
    sp_loc = (By.XPATH,'/html/body/div[8]/div[1]/div[2]/div[2]/ul/li[2]/div[1]/a/img')
    def sp(self):
        self.click(self.sp_loc)
    #点击加入购物车
    gwc_loc = (By.ID,'add-cart')
    def gwc(self):
        self.click(self.gwc_loc)
    #点击查看购物车
    ck_loc = (By.CLASS_NAME,'ico-cart')
    def ck(self):
        self.click(self.ck_loc)
